<?php defined('SYSPATH') OR die('No direct access allowed.');

class Page_Controller extends Viewbase_Controller{
	
	public function __construct(){
		
		$this->modelname='page';
		$this->controllername='page';
		$this->parent_column='parent_id';
		$this->forms=array(array('title'=>'Input', 'link'=>'input'),  array('title'=>'Action', 'link'=>'action'));
		
		parent::__construct();	
		
		$this->template->head=new View('langselect');
			
	}
	
	public function index(){
		$this->listall();
	}
	
	
	public function __postprocess_model($model){
		
		if(!$model->shortname_check($model->shortname)){
			$model->shortname=url::title($model->title).'_'.$model->id;
			$model->save();
		}
		
		if($this->input->post('formid')=='contmodselect'){
			$model->contentmodule_parameters=json_encode($this->input->post('contmod_array'));	
		}
		
		//$model->save();
		//foreach($this->settings['lang'] as $lang=>$langname){
			//$model->get_meta_object($lang);
		//}
	}	
}